package com.carck.mapper;

import com.carck.pojo.Group;
import com.carck.pojo.Model;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;

@Mapper
public interface ModelMapper {
    @Select("select count(*) from model where group_name=#{groupName} and model_name=#{modelName}")
    Integer isInModel(String groupName,String modelName);
    @Select("select distinct group_name from model")
    ArrayList<String> listGroupNames();
    @Select("select model_name from model where group_name=#{groupName}")
    ArrayList<String> getGroupModels(String groupName);
    @Insert("insert into model(group_name,model_name,file_name) values(#{groupName},#{modelName},#{fileName})")
    void add(String groupName,String modelName,String fileName);
    @Select("select file_name from model where group_name=#{groupName} and model_name=#{modelName}")
    String getFileURL(Model model);
}
